Presentation Request Callback
-
Purpose:
Handles requests for presenting proof. -
Functionality:
- Can Prompts the user with a modal interface to select credentials if necessary.
-
Usage:
Coordinates the workflow for presenting proofs, ensuring that the correct credentials are selected and returned in the response. -
Example:
presentationRequestCallback: async (proofItem: PresentationRequest) => {
return new Promise(resolve => {
RootNavigation.dispatch(
StackActions.push('ProofRequestScreen', {
title: proofItem.name,
details: proofItem.goalCode,
presentationRequest: proofItem,
primaryButton: {
caption: 'Send',
onPress: async (result: PresentationResponseItem[]) => {
const response: ProofRequestCallbackResponse = {
//action is send if the user sent the proof
action: ProofRequestCallbackAction.Send,
response: result,
};
resolve(response);
RootNavigation.goBack();
},
},
secondaryButton: {
caption: 'Cancel',
onPress: async () => {
const response: ProofRequestCallbackResponse = {
//action is reject if the user reject the proof
action: ProofRequestCallbackAction.Reject,
response: [],
};
resolve(response);
RootNavigation.goBack();
},
},
onClose: async () => {
const response: ProofRequestCallbackResponse = {
action: ProofRequestCallbackAction.Later,
response: [],
};
resolve(response);
},
}),
);
});
},